<template>
  <div class="header">
    <div class="page-title">信息管理</div>
    <el-form ref="form" :model="form" label-width="100px">
      <el-form-item label="短信内容">
        <el-input
          ref="name"
          v-model="form.name"
          placeholder="请输入短信内容"
        ></el-input>
      </el-form-item>

      <el-form-item label="手机号.">
        <el-input
          ref="serial"
          v-model="form.serial"
          placeholder="请输入手机号"
        ></el-input>
      </el-form-item>

      <el-form-item label="地址.">
        <el-input
          ref="code"
          v-model="form.code"
          placeholder="请输入地址"
        ></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-check" @click="submit"
          >确定</el-button
        >
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { post } from "@/network/request";
import { __URL__ } from "@/main";

export default {
  name: "AddOffice",
  data() {
    return {
      uploadImage: __URL__ + "/uploadImage", // 上传图片地址
      form: {
        name: "",
        code: "",
        serial: "",
      },
    };
  },
  mounted() {
    this.form.status = true;
  },
  methods: {
    // 提交
    submit() {
      post("/addOffice", this.form)
        .then((res) => {
          const result = res.data;
          if (result.code == 200) {
            this.$notify.success({
              title: "系统提示",
              message: "设备添加成功",
              offset: 70,
            });
            this.$router.push("/office");
          } else {
            this.$notify.error({
              title: "系统提示",
              message: result.message,
              offset: 70,
            });
          }
        })
        .catch();
    },
    // 取消
    cancel() {
      this.$router.push("/office");
    },
  },
};
</script>

<style>
</style>